Optimal. Leaf size=86 \[ \frac {\left (2 a^2 B+4 a A b+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 A x+\frac {b (3 a B+2 A b) \tan (c+d x)}{2 d}+\frac {b B \tan (c+d x) (a+b \sec (c+d x))}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.08, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3918, 3770, 3767, 8} \[ \frac {\left (2 a^2 B+4 a A b+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 A x+\frac {b (3 a B+2 A b) \tan (c+d x)}{2 d}+\frac {b B \tan (c+d x) (a+b \sec (c+d x))}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3767
Rule 3770
Rule 3918
Rubi steps
\begin {align*} \int (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx &=\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} \int \left (2 a^2 A+\left (4 a A b+2 a^2 B+b^2 B\right ) \sec (c+d x)+b (2 A b+3 a B) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 A x+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} (b (2 A b+3 a B)) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (4 a A b+2 a^2 B+b^2 B\right ) \int \sec (c+d x) \, dx\\ &=a^2 A x+\frac {\left (4 a A b+2 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {(b (2 A b+3 a B)) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=a^2 A x+\frac {\left (4 a A b+2 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b (2 A b+3 a B) \tan (c+d x)}{2 d}+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.28, size = 67, normalized size = 0.78 \[ \frac {\left (2 a^2 B+4 a A b+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))+2 a^2 A d x+b \tan (c+d x) (4 a B+2 A b+b B \sec (c+d x))}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.46, size = 136, normalized size = 1.58 \[ \frac {4 \, A a^{2} d x \cos \left (d x + c\right )^{2} + {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (B b^{2} + 2 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.29, size = 192, normalized size = 2.23 \[ \frac {2 \, {\left (d x + c\right )} A a^{2} + {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (4 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.94, size = 133, normalized size = 1.55 \[ a^{2} A x +\frac {A \,a^{2} c}{d}+\frac {B \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {2 A a b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {2 B a b \tan \left (d x +c \right )}{d}+\frac {A \,b^{2} \tan \left (d x +c \right )}{d}+\frac {b^{2} B \sec \left (d x +c \right ) \tan \left (d x +c \right )}{2 d}+\frac {b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 1.39, size = 126, normalized size = 1.47 \[ \frac {4 \, {\left (d x + c\right )} A a^{2} - B b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 8 \, A a b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 8 \, B a b \tan \left (d x + c\right ) + 4 \, A b^{2} \tan \left (d x + c\right )}{4 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.74, size = 176, normalized size = 2.05 \[ \frac {2\,\left (A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+B\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {B\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+2\,A\,a\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\right )}{d}+\frac {\frac {A\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {B\,b^2\,\sin \left (c+d\,x\right )}{2}+B\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________